package top.leetcode;

/**
 * @Desc
 * @Author houruiyang
 * @Date 2022/12/22
 **/
public class _027 {
    public static void main(String[] args) {
        int i = removeElement(new int[]{3, 2, 2, 3}, 3);
        System.out.println(i);
    }


    public static int removeElement(int[] nums, int val) {
        int idx = 0;
        for (int x : nums) {
            if (x != val) {
                nums[idx++] = x;
            }
        }
        return idx;
    }

}
